package edu.gznu.ics.fast.pulsar.controller;

import edu.gznu.ics.fast.pulsar.service.userService.ResourceService;
import edu.gznu.ics.fast.pulsar.service.userService.UserService;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller

public class ViewIndexController {
	@Autowired
	private ResourceService resourceService;
	@Autowired
	private UserService userService;
	/*@RequestMapping(value = {"/start.do"})
	public String index() {
		return "start";
	}*/
	/*@RequestMapping(value = {"/login"})
	public String login() {
		return "login";
	}*/
	/*@RequestMapping(value = {"/register"})
	public String register() {
		return "register";
	}*/
	@RequestMapping(value = {"/apptask"})
	public String applyNewTask() {
		return "NewTask";
	}

    /*@RequestMapping(value = {"/newtaskPara"})
    public String addNewComputeTaskPara() {
        return "editPara";
    }
    @RequestMapping(value = {"/startTask"})*/
    public String startComputeTask() {
		return "starttask";
	}
	@RequestMapping(value = {"/showpic"})
	public String showpicinfo() {
        return "pic/picrank";
    }

	@RequestMapping(value = {"/showcompare"})
	public String showcompareinfo() {
		return "pic/compareinfo";
	}

	@RequestMapping(value = {"/compare"})
	public String comparecandidate() {
        return "res/compare";
    }
	@RequestMapping(value = {"/compresult"})
	public String comparecandidatereresult() {
        return "res/compareresult";
    }
	@RequestMapping(value = {"/comp1"})
	public String comparecandidaterer() {
		return "compareresult";
	}

    @RequestMapping(value = {"/cluster"})
    public String clusterMonter() {
        return "cluster/clusterMoniter";
    }

	@RequestMapping("/")
	public String index(/*@CurrentUser TdUserVO loginUser, Model model*/) {
		//Set<String> permissions = userService.findPermissionsByUsername(loginUser.getUserName());
		//List<uiResource> menus = resourceService.findMenus(permissions);
	//	model.addAttribute("menus", menus);
		return "start";
	}

	@RequestMapping("/welcome")
	public String welcome() {
		return "welcome";
	}
	//系统首页
	@RequestMapping("/first")
	public String first(Model model)throws Exception{
		return "start";
	}

    @RequestMapping("/editpara")
    public String editPara(Model model) throws Exception {
        return "task/editpara";
    }

    @RequestMapping("*")
    public String notfound(Model model) throws Exception {
        return "status/404";
    }


    public String getUser() {

        return SecurityUtils.getSubject().getPrincipal().toString();
    }
}
